/**
 * 
 */
define(function(require) {
	var exitNotice = function(){
		var referrer = appcan.ls.val('referrer');
		if(referrer){
			referrer=referrer.split(',');
		}
		appcan.ls.remove('notice');
		setTimeout(function(){
			appcan.ls.remove('referrer');
			if(referrer){
				appcan.openView(null,referrer[0],referrer[1]);
			}else{
				appcan.window.close();
			}
		},0);
	}
	var notice = appcan.ls.val('notice');
	if(notice){
		$('#noticeText').text(notice);
	}
	$('.notice-btns .btn-primary').on('click',exitNotice);
	
	appcan.ready(function(){
		//禁止返回
		appcan.window.monitorKey(0,function(){
			exitNotice();
		});
		// uexWindow.onKeyPressed = function(keyCode) {
		// 	if (keyCode == 0) {
		// 		exitNotice();
		// 	}
		// }
		// uexWindow.setReportKey(0,1);
		appcan.window.on('pause',function(){
			appcan.window.close();
		});
	});
});